package com.cdd.goods.controller;

import com.cdd.goods.service.IGoodsTypeService;
import com.common.entity.GoodsSpecification;
import com.common.entity.GoodsType;
import com.common.untils.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import sun.dc.pr.PRError;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lzl
 * @since 2022-09-01
 */
@RestController
@RequestMapping("/goods/goodsType")
public class GoodsTypeController {
    @Autowired
    private IGoodsTypeService iGoodsTypeService;
    @PostMapping("/selectAll/{currentPage}/{pageSize}")
    public CommonResult selectAll(@PathVariable Integer currentPage,@PathVariable Integer pageSize,@RequestBody GoodsType goodsType){
        return iGoodsTypeService.selectAll(currentPage,pageSize,goodsType);
    }
    @PostMapping("/select")
    public CommonResult seect(){
     return iGoodsTypeService.select();
    }
    @PostMapping("/delectGoodsType/{id}")
    public CommonResult delectGoodsBrand(@PathVariable Integer id){
        return iGoodsTypeService.delectGoodsType(id);
    }
    @PostMapping("/updateGoodsType")
    public CommonResult updateGoodsBrand(@RequestBody GoodsType goodsType){
        return iGoodsTypeService.updateGoodsType(goodsType);
    }
    @PostMapping("/insertGoodsType")
    public CommonResult insertGoods(@RequestBody GoodsType goodsType){
        System.out.println(goodsType);
        return iGoodsTypeService.insertType(goodsType);
    }


}
